import 'package:json_annotation/json_annotation.dart';
import 'dart:convert';

part 'getinfo_entity.g.dart';

/// 获取用户信息响应实体
@JsonSerializable()
class GetinfoEntity {
  /// 响应消息
  @JsonKey(name: 'msg')
  String? msg;
  
  /// 响应状态码
  @JsonKey(name: 'code')
  int? code;
  
  /// 用户权限列表
  @JsonKey(name: 'permissions')
  List<String>? permissions;
  
  /// 用户角色列表
  @JsonKey(name: 'roles')
  List<String>? roles;
  
  /// 用户信息
  @JsonKey(name: 'user')
  GetinfoUser? user;

  GetinfoEntity({
    this.msg,
    this.code,
    this.permissions,
    this.roles,
    this.user,
  });

  factory GetinfoEntity.fromJson(Map<String, dynamic> json) => _$GetinfoEntityFromJson(json);

  Map<String, dynamic> toJson() => _$GetinfoEntityToJson(this);

  @override
  String toString() {
    return jsonEncode(this);
  }
}

/// 用户信息实体
@JsonSerializable()
class GetinfoUser {
  /// 创建者
  @JsonKey(name: 'createBy')
  String? createBy;
  
  /// 创建时间
  @JsonKey(name: 'createTime')
  String? createTime;
  
  /// 用户参数
  @JsonKey(name: 'params')
  GetinfoUserParams? params;
  
  /// 用户类型
  @JsonKey(name: 'userType')
  String? userType;
  
  /// 用户ID
  @JsonKey(name: 'userId')
  int? userId;
  
  /// 用户名
  @JsonKey(name: 'userName')
  String? userName;
  
  /// 昵称
  @JsonKey(name: 'nickName')
  String? nickName;
  
  /// 邮箱
  @JsonKey(name: 'email')
  String? email;
  
  /// 手机号
  @JsonKey(name: 'phonenumber')
  String? phonenumber;
  
  /// 性别
  @JsonKey(name: 'sex')
  String? sex;
  
  /// 头像
  @JsonKey(name: 'avatar')
  String? avatar;
  
  /// 密码
  @JsonKey(name: 'password')
  String? password;
  
  /// 状态
  @JsonKey(name: 'status')
  String? status;
  
  /// 删除标志
  @JsonKey(name: 'delFlag')
  String? delFlag;
  
  /// 登录IP
  @JsonKey(name: 'loginIp')
  String? loginIp;
  
  /// 用户角色列表
  @JsonKey(name: 'roles')
  List<GetinfoUserRoles>? roles;
  
  /// 是否管理员
  @JsonKey(name: 'admin')
  bool? admin;

  GetinfoUser({
    this.createBy,
    this.createTime,
    this.params,
    this.userType,
    this.userId,
    this.userName,
    this.nickName,
    this.email,
    this.phonenumber,
    this.sex,
    this.avatar,
    this.password,
    this.status,
    this.delFlag,
    this.loginIp,
    this.roles,
    this.admin,
  });

  factory GetinfoUser.fromJson(Map<String, dynamic> json) => _$GetinfoUserFromJson(json);

  Map<String, dynamic> toJson() => _$GetinfoUserToJson(this);

  @override
  String toString() {
    return jsonEncode(this);
  }
}

/// 用户参数实体
@JsonSerializable()
class GetinfoUserParams {
  GetinfoUserParams();

  factory GetinfoUserParams.fromJson(Map<String, dynamic> json) => _$GetinfoUserParamsFromJson(json);

  Map<String, dynamic> toJson() => _$GetinfoUserParamsToJson(this);

  @override
  String toString() {
    return jsonEncode(this);
  }
}

/// 用户角色实体
@JsonSerializable()
class GetinfoUserRoles {
  /// 角色参数
  @JsonKey(name: 'params')
  GetinfoUserRolesParams? params;
  
  /// 角色ID
  @JsonKey(name: 'roleId')
  int? roleId;
  
  /// 角色名称
  @JsonKey(name: 'roleName')
  String? roleName;
  
  /// 角色键
  @JsonKey(name: 'roleKey')
  String? roleKey;
  
  /// 角色排序
  @JsonKey(name: 'roleSort')
  String? roleSort;
  
  /// 数据范围
  @JsonKey(name: 'dataScope')
  String? dataScope;
  
  /// 菜单检查严格模式
  @JsonKey(name: 'menuCheckStrictly')
  bool? menuCheckStrictly;
  
  /// 部门检查严格模式
  @JsonKey(name: 'deptCheckStrictly')
  bool? deptCheckStrictly;
  
  /// 状态
  @JsonKey(name: 'status')
  String? status;
  
  /// 标志
  @JsonKey(name: 'flag')
  bool? flag;
  
  /// 是否管理员
  @JsonKey(name: 'admin')
  bool? admin;

  GetinfoUserRoles({
    this.params,
    this.roleId,
    this.roleName,
    this.roleKey,
    this.roleSort,
    this.dataScope,
    this.menuCheckStrictly,
    this.deptCheckStrictly,
    this.status,
    this.flag,
    this.admin,
  });

  factory GetinfoUserRoles.fromJson(Map<String, dynamic> json) => _$GetinfoUserRolesFromJson(json);

  Map<String, dynamic> toJson() => _$GetinfoUserRolesToJson(this);

  @override
  String toString() {
    return jsonEncode(this);
  }
}

/// 用户角色参数实体
@JsonSerializable()
class GetinfoUserRolesParams {
  GetinfoUserRolesParams();

  factory GetinfoUserRolesParams.fromJson(Map<String, dynamic> json) => _$GetinfoUserRolesParamsFromJson(json);

  Map<String, dynamic> toJson() => _$GetinfoUserRolesParamsToJson(this);

  @override
  String toString() {
    return jsonEncode(this);
  }
}